<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
    <%@include file="/WEB-INF/jsp/common.jsp"%>
</head>
<body>
<h2>权限列表</h2>
<hr>
<table id="perTable" lay-filter="perTable"></table>

<script>
    layui.config({
        base: '${path}/layui/lay/modules/'
    }).extend({
        treeGrid:'treeGrid'
    })

    layui.use('treeGrid',function () {
        var treeGrid = layui.treeGrid;

        $.get('${path}/sysPermission/list',function (d) {
            $.each(d.data,function () {
                this.isOpen = false;
            });
            treeGrid.render({
                elem : '#perTable',
                data : d.data,
                treeId : 'id',
                treeUpId : 'parentid',
                treeShowName : 'text',
                toolbar:'#toolbarDemo',
                cols : [[
                    {field:'id', title:'编号',width:80},
                    {field:'text', title:'权限名称'},
                    {field:'type', title:'类型'},
                    {field:'url', title:'链接地址'},
                    {field:'available', title:'是否可用'}
                ]]
            });
        });
    });

</script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon layui-icon-add-circle"></i> 添加</button>
        <button class="layui-btn layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i> 批量删除</button>
        <button class="layui-btn layui-btn-sm" lay-event="import"><i class="layui-icon layui-icon-export"></i> 导入数据</button>
    </div>
</script>

</body>
</html>
